{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<div class="span7">
  {{#if view.isUpgradeFailed}}
    {{#if App.isAdmin}}
      <a href="#" {{action "upgradeComponent" view.content target="controller"}} >
        <i title="Component upgrade failed" class="components-health icon-arrow-up"></i>
      </a>
    {{/if}}
  {{else}}
    <span rel='componentHealthTooltip' {{bindAttr class="view.statusClass view.statusIconClass :components-health" data-original-title="view.componentTextStatus"}}></span>&nbsp;
  {{/if}}
  {{#if component.displayNameAdvanced}}
    {{component.displayNameAdvanced}}
  {{else}}
    {{component.displayName}}
  {{/if}}
  &nbsp;/&nbsp;
  <a href="#" {{action routeToService component.service target="controller"}}>{{component.service.displayName}}</a>
  &nbsp;
  {{#if component.staleConfigs}}
    <span class="text-warning icon-refresh"></span>
  {{/if}}
  {{#unless component.isActive}}
    <span class="icon-medkit"></span>
  {{/unless}}
</div>
<div class="span5 pull-right">
  {{#if App.isAdmin}}
    <div class="btn-group pull-right">
      <a {{ bindAttr class="view.disabled :btn :dropdown-toggle"}} data-toggle="dropdown">
        {{view.componentTextStatus}}
        <span class="caret pull-right"></span>
      </a>
      <ul class="dropdown-menu">
        {{#if view.isComponentDecommissionAvailable}}
          {{view view.decommissionView}}
        {{/if}}
        {{#if view.isComponentRecommissionAvailable}}
          {{view view.decommissionView}}
        {{/if}}
        {{#if view.isRestartableComponent}}
          <li {{bindAttr class="view.isRestartComponentDisabled:hidden"}}>
            <a href="javascript:void(null)" data-toggle="modal" {{action "restartComponent" view.content target="controller"}}>
              {{t common.restart}}
            </a>
          </li>
        {{/if}}
        {{#unless view.isInstalling}}
          {{#if view.isStart}}
            <li {{bindAttr class="view.isComponentDecommissioning:hidden view.noActionAvailable"}}>
              <a href="javascript:void(null)" data-toggle="modal" {{action "stopComponent" view.content target="controller"}}>
                {{t common.stop}}
              </a>
            </li>
          {{/if}}
          {{#unless view.isStart}}
            {{#unless view.isInit}}
              <li {{bindAttr class="view.isUpgradeFailed:hidden view.isInstallFailed:hidden view.isDecommissioning:hidden view.noActionAvailable"}}>
                <a href="javascript:void(null)" data-toggle="modal" {{action "startComponent" view.content target="controller"}}>
                  {{t common.start}}
                </a>
              </li>
            {{/unless}}
          {{/unless}}
          {{#if view.isUpgradeFailed}}
            <li {{bindAttr class="view.noActionAvailable"}}>
              <a href="javascript:void(null)" data-toggle="modal" {{action "upgradeComponent" view.content target="controller"}}>
                {{t common.reUpgrade}}
              </a>
            </li>
          {{/if}}
          {{#if view.isInstallFailed}}
            <li {{bindAttr class="view.noActionAvailable"}}>
              <a href="javascript:void(null)" data-toggle="modal" {{action "installComponent" view.content target="controller"}}>
                {{t common.reinstall}}
              </a>
            </li>
          {{/if}}
          {{#if view.isReassignable}}
            <li {{bindAttr class="view.noActionAvailable"}}>
              <a href="javascript:void(null)" data-toggle="modal" {{action "moveComponent" view.content target="controller"}}>
                {{t common.move}}
              </a>
            </li>
          {{/if}}
          <li {{bindAttr class="view.noActionAvailable"}}>
            <a href="javascript:void(null)"
               data-toggle="modal" {{action "toggleMaintenanceMode" view.content target="controller"}}>
              {{#if view.isActive}}
                {{t passiveState.turnOn}}
              {{else}}
                {{t passiveState.turnOff}}
              {{/if}}
            </a>
          </li>
        {{/unless}}
        {{#if view.isInit}}
          <li {{bindAttr class="view."}}>
            <a href="javascript:void(null)" data-toggle="modal" {{action "installComponent" view.content target="controller"}}>
              {{t common.reinstall}}
            </a>
          </li>
        {{/if}}
        {{#if view.isDeletableComponent}}
            <li {{bindAttr class="view.isDeleteComponentDisabled:disabled"}}>
                <a href="javascript:void(null)" data-toggle="modal" {{action "deleteComponent" view.content target="controller"}}>
                  {{t common.delete}}
                </a>
            </li>
        {{/if}}
        {{#if view.isRefreshConfigsAllowed}}
            <li>
                <a href="javascript:void(null)" data-toggle="modal" {{action "refreshComponentConfigs" view.content target="controller"}}>
                  {{t hosts.host.details.refreshConfigs}}
                </a>
            </li>
        {{/if}}

      {{#each command in view.customCommands}}
        <li>
          <a href="javascript:void(null)" {{action "executeCustomCommand" command target="controller" href=true}}>{{command.label}}</a>
        </li>
      {{/each}}
      </ul>
    </div>
  {{/if}}
</div>
